<?php

namespace App\Http\Validate\Order;

use App\Http\Validate\BaseValidate;

/**
 * 出库单验证器
 */
class Outboundorder extends BaseValidate
{
    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];

    public function __construct($doaction = 'add')
    {
        if ($doaction == 'add') {
            $this->rule = [
                'order_number' => 'required',
                'document_date' => 'required',
                'bill_type' => 'required',
                'business_type' => 'required',
                'custom_id' => 'required',
                'custom_name' => 'required',
                'wagon_number' => 'required',
                'warehouse_return_order' => 'required',
            ];
            $this->message = [
                'order_number.required' => '销售订单号不能为空',
                'document_date.required' => '单据日期不能为空',
                'bill_type.required' => '票据类型不能为空',
                'business_type.required' => '业务类型不能为空',
                'custom_id.required' => '客户id不能为空',
                'custom_name.required' => '客户名称不能为空',
                'wagon_number.required' => '车船号不能为空',
                'warehouse_return_order.required' => '仓库返单不能为空',
            ];
        } elseif ($doaction == 'edit') {
            $this->rule = [
                'document_date' => 'required',
            ];
            $this->message = [
                'document_date.required' => '单据日期不能为空',
            ];
        }
    }
}
